#define _CRT_SECURE_NO_WARNINGS 1

#include <iostream>
#define MAXSIZE 1000
using namespace std;

typedef struct
{
    int R[MAXSIZE];
    int length;
}SSTable;

void CreateSSTable(SSTable &ST, int n)
{
    ST.length = n;
    for (int i = 1; i <= n; i++)
    {
        cin >> ST.R[i];
    }

}

int Search_SSTable(SSTable &S, int key)
{
    int low = 1;
    int high = S.length;
    int mid = 0;
    while (low <= high)
    {
        mid = (low + high) / 2;
        if (S.R[mid] == key)
        {
            int k = mid;
            for (int i = mid; i >= 0; i--)
            {
                if (key == S.R[i])
                {
                    k = i;
                }
            }
            return k - 1;
        }
        else if (key < S.R[mid])
        {
            high = mid - 1;
        }
        else
        {
            low = mid + 1;

        }
    }
    return -1;
}

int main()
{
    int n;//有n个整数
    int k;//k次查询
    cin >> n >> k;
    if (n > 1000 || k > 1000)
    {
        return 0;
    }
    SSTable ST;
    CreateSSTable(ST, n);

    int m = 0;
    for (int i = 0; i < k; i++)
    {
        cin >> m;
        cout << Search_SSTable(ST, m) << " ";
    }
    cout << endl;
    return 0;
}